import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import JidanciApp from '../views/itjidanci/JidanciApp.vue'
import AiCodingApp from '../views/aicoding/AiCodingApp.vue'
import UCenterApp from '../views/ucenter/UCenterApp.vue'
import Home from '../views/home/Index.vue'
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Home',
    component: Home,
  },
  {
    path: '/itjidanci',
    name: 'JidanciApp',
    component: JidanciApp,
    redirect: '/itjidanci/index',
    children: [
      {
        path: 'index',
        name: 'ItjidanciDashboard',
        component: () => import(/* webpackChunkName: "columnlist" */ '../views/itjidanci/Dashboard.vue')
      },
      {
        path: 'roots',
        name: 'Roots',
        component: () => import(/* webpackChunkName: "roots" */ '../views/itjidanci/Roots.vue')
      },
      {
        path: 'affixes',
        name: 'affixes',
        component: () => import(/* webpackChunkName: "affixes" */ '../views/itjidanci/Affixes.vue')
      },
      {
        path: 'columns',
        name: 'Columns',
        component: () => import(/* webpackChunkName: "columns" */ '../views/itjidanci/Columns.vue')
      },
    ]
  },
  {
    path: '/aicoding',
    name: 'AiCodingApp',
    component: AiCodingApp
  },
  // 用户中心
  {
    path:'/ucenter',
    name: 'UCenterApp',
    component: UCenterApp,
    redirect: '/ucenter/index',
    children: [
      {
        path:'index',
        name:'UcenterDashboard',
        component: () => import(/* webpackChunkName: "UcenterDashboard" */ '../views/ucenter/Dashboard.vue'),
      },
      {
        path:'post/article',
        name:'PostArticle',
        component:() => import(/* webpackChunkName: "UcenterDashboard" */ '../views/ucenter/PostArticle.vue'),
      },
      {
        path:'articles',
        name:'UCenterArticles',
        component:() => import(/* webpackChunkName: "UCenterArticles" */ '../views/ucenter/Articles.vue'),
      },
      {
        path:'columns',
        name:'UCenterColumns',
        component:() => import(/* webpackChunkName: "UCenterColumns" */ '../views/ucenter/Columns.vue'),
      }
    ]
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'not-found',
    component:  () => import(/* webpackChunkName: "not-found" */ '../views/404.vue'),
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

router.resolve({
  name: 'not-found',
  params: { pathMatch: ['not', 'found'] },
}).href // '/not/found'

export default router
